<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<div id="dialogDeleteOrg"></div>
<div class="v-row v-border-bottom" style="padding-top: 10px;">
	<div class="v-row-left" style="margin-left: 10px;">
		<span class="v-title">
			<spring:message  code="project.list.member" />
		</span>
	</div>	
</div>          		
<div class="v-row">
	<div class="v-row-left">							 																
		<fieldset>
	    <legend><spring:message  code="employee.rank"/></legend>
	    <select  style="width: 150px;" name="rankId">	
	    <option value="0"><spring:message  code="all"/></option>
            <c:forEach items="${bean.ranks}" var="rank">
				<c:choose>
					<c:when test="${rank.rankid == bean.rankId}">
                           <option value="${rank.rankid}" selected="selected">${rank.name}</option>
					</c:when>
					<c:otherwise>
						<option value="${rank.rankid}">${rank.name}</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		 </select>
	     </fieldset>						
	</div>				
	<div class="v-row-left">
		<fieldset style="margin-left: 20px;">
		<legend><spring:message  code="employee.diploma"/></legend>
		<select  style="width: 150px;" name="diplomaId">  
            <option value="0"><spring:message  code="all"/></option>          
            <c:forEach items="${bean.diplomas}" var="diploma">
				<c:choose>
					<c:when test="${diploma.diplomaid == bean.diplomaId}">
						<option value="${diploma.diplomaid}" selected="selected">${diploma.name}</option>
					</c:when>
					<c:otherwise>
						<option value="${diploma.diplomaid}">${diploma.name}</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		</select>
		</fieldset>
	  </div> 	
	  <div class="v-row-left">
		<fieldset style="margin-left: 20px;">
		<legend><spring:message  code="employee.languages"/></legend>
		<select  style="width:150px;" name="language">  
           <option value=""><spring:message  code="all"/></option>          
            <c:forEach items="${bean.languages}" var="language">
				<c:choose>
					<c:when test="${language.name == bean.language}">
						<option value="${language.name}" selected="selected">${language.name}</option>
					</c:when>
					<c:otherwise>
						<option value="${language.name}">${language.name}</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		</select>
		</fieldset>
	 </div> 				    		     
	  <div class="v-row-right" style="padding-top: 20px;">
			<input class="txt-search" maxLength="100" type="text" value="${bean.searchKey}" title="Keyword..."
			       style="width: 250px;height: 20px;" name="searchKey" />					
			<input type="button" id="searchMembers" class="bt-form" value="<spring:message  code="search"/>" />
	  </div>				
</div>        
<div class="v-row" id="v-global-message">	
   <c:if test="${deleteOK == true }">
      	<span class="v-global-success-message v-row">
      	    <span><spring:message  code="project.delete.members.success" /></span>
      	</span>
   </c:if>
</div>	 
 <div class="v-row">         								
<div>
  <table class="v-table" id="mytable">
        <thead>
          <tr class="v-table-header">
			<th width="40"><spring:message code="title.no" /></th>
			<c:if test="${bean.isAdmin == true }">  
			<th width="40"><input class="ckbSelectAll" type="checkbox" /></th>
			</c:if>
			<th width="150"><spring:message code="employee.fullname" /></th>
			<th width="100"><spring:message code="employee.visa" /></th>
			<th width="100"><spring:message code="employee.rank" /></th>
			<th width="100"><spring:message code="employee.diploma" /></th>
			<th width="100"><spring:message code="employee.languages" /></th>
			<th width="150" ><spring:message code="employee.function" /></th>
		  </tr>
        </thead>
	    <tbody>		
		<c:choose>
			<c:when test="${bean.countList == 0}">
				<tr>
					<td colspan="8" class="v-warning-message">
						<spring:message code="search.empty" />
					</td>
				</tr>
			</c:when>
			<c:otherwise>
				<c:forEach items="${bean.efips}" var="efip" varStatus="count">						
					<tr class="${count.count % 2 != 0 ? 'v-table-row-0' : 'v-table-row-1'}">
					<td scope="row" class="v-number-cell">
					    <c:out value="${count.count + ( bean.paging.currentPage - 1 ) * bean.paging.pageSize}" />								
					</td>
                    <c:if test="${bean.isAdmin == true }">  
					<td scope="row" class="v-number-cell">		
					    <spring:bind path="employeeFunctionInProjects[${count.index}].employee.employeeid">					 					
					    <c:choose>
					      <c:when test="${efip.function.functionid == bean.GL}">					        
					          <input type="checkbox" disabled = 'disabled' name="${status.expression}" class="ckbChild" value="${efip.employee.employeeid}"/>					      	  
					      </c:when>
					      <c:otherwise>					       
					           <input type="checkbox" name="${status.expression}" class="ckbChild" value="${efip.employee.employeeid}"/>					       	
					      </c:otherwise>
					    </c:choose>	
					    </spring:bind>																    												    														   							   
					</td>
                    </c:if>
					<td scope="row" class="v-text-cell">
					    <c:out value="${efip.employee.lastname} ${efip.employee.firstname}" />
					</td>						
					<td scope="row" class="v-text-cell">
					   <c:out value="${efip.employee.visa}" />
					</td>						
					<td scope="row" class="v-text-cell">
					    <c:out value="${efip.employee.rank.name}" />
					</td>						
					<td scope="row" class="v-text-cell">
					    <c:out value="${efip.employee.diploma.name}" />
					</td>
					<td scope="row" class="v-text-cell">
					    <c:out value="${efip.employee.languages}" />
					</td>
					<td scope="row" class="v-text-cell">													
						  <c:out value="${efip.function.name}" />
					</td>						   
					</tr>
				</c:forEach>
			</c:otherwise>
		</c:choose>
	</tbody>
	</table>
</div>
<c:if test="${bean.isAdmin == true && bean.countList > 0}">		
<div class="v-row">
		    <br/>
			<div class="v-row-center">
				<span>
				<input type="button" class="bt-form" name="deleteMembers" id="deleteMembers" 
					   value="<spring:message code="button.delete" />" />
				</span>				
				<span>
				<input type="button" class="bt-form" value="<spring:message code="button.cancel"/>" 
						onclick="cancel('<c:out value='${bean.returnToFullPageURL }'/>')"/>
				</span>
			</div>
</div>
</c:if>		
<c:if test="${bean.countList > 0}">
	<div class="v-row">
		<c:set value="${bean.paging}" var="paging"></c:set>
		<%@ include file="../common/pagination.jsp"%>
	</div>
</c:if>
</div>